import React, {Component} from 'react';
import storageUtil from "../../../../utils/storageUtil";
import {List, Avatar,PageHeader} from 'antd';

class Qa extends Component {

    state = {
        qa: '',
        oid: ''
    }

    componentWillMount(){
        const oid = storageUtil.getOrder().oid
        this.$myAxios.get('/question/showQA/' + oid).then(res => {
            console.log(res.data)
            this.setState({
                qa: res.data
            })
        })
    }

    render() {
        return (
            <div>
                <PageHeader
                    className="site-page-header"
                    onBack={() => {
                        this.props.history.push("/admin/myOrder")
                    }}
                    title="返回所有工单"
                />

                <List
                    itemLayout="horizontal"
                    dataSource={this.state.qa}
                    renderItem={item => (
                        <List.Item>
                            <List.Item.Meta
                                avatar={<Avatar src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" />}
                                title={item.question}
                                description={item.answer}
                            />
                        </List.Item>
                    )}
                />
            </div>

        );
    }
}

export default Qa;